package cn.hl.sfzy.controller;

import cn.hl.sfzy.entity.UserMark;
import cn.hl.sfzy.service.UserMarkService;
import cn.hl.sfzy.util.Result;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserMarkController
 * @Description TODO
 * @Author LiuYao
 * @Date 2024年10月24日 11:51
 * @Version 1.0
 */
@RestController
@RequestMapping("/userMark")
public class UserMarkController {
    @Autowired
    private UserMarkService userMarkService;

    @DeleteMapping("/delete/{id}")
    public Object delete(@PathVariable("id") Long id){
        userMarkService.remove(id);
        return Result.success("删除成功！");
    }

    @GetMapping("/findByPage")
    public Object findByPage(@RequestParam(required = false,defaultValue = "1") Integer pageNum,
                             @RequestParam(required = false,defaultValue = "5") Integer pageSize,
                             UserMark userMark){
        PageInfo pageInfo = userMarkService.findByPage(pageNum, pageSize, userMark);
        return Result.success(pageInfo);
    }
}
